﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Cylong.Cache
{
    public class CylongCacheFactory
    {
        /// <summary>
        /// 默认为缓存
        /// </summary>
        /// <param name="cacheType"></param>
        /// <returns></returns>
        public static ICacheProvider Get(ECacheType cacheType = ECacheType.Redis)
        {
            switch (cacheType)
            {
                case ECacheType.Redis:
                    return new RedisService();
                case ECacheType.Memcahce:
                    return new MemcahceCache();
                default:
                    return new RedisService();
            }
        }

        /// <summary>
        /// redis一些特定操作
        /// </summary>
        /// <returns></returns>
        public static RedisService Redis()
        {
            return new RedisService();
        }

        /// <summary>
        /// Memcahce一些特定操作
        /// </summary>
        /// <returns></returns>
        public static MemcahceCache Memcahce()
        {
            return new MemcahceCache();
        }
    }
    /// <summary>
    /// 缓存类型
    /// </summary>
    public enum ECacheType
    {
        Redis,
        Memcahce
    }
} 
